import os
import os.path as osp
from tqdm import tqdm
import xml.etree.ElementTree as ET
xmlroot = '/media/hp208/4t/zhaoxingjie/project_graduation/data/HongWaidevkit/hongwai/Annotations'

namedict = []
xmlnames = os.listdir(xmlroot)
for name in tqdm(xmlnames):
    xml_path = osp.join(xmlroot, name)
    tree = ET.parse(xml_path)
    root = tree.getroot()
    size = root.find('size')
    for obj in root.findall('object'):
        name = obj.find('name').text
        if name not in namedict:
            namedict.append(name)

print(namedict)